home *** CD-ROM | disk | FTP | other *** search
/ Champak 141 / (Vol 141) Oct 17 2011.iso / Games / flight-of-the-museum.swf / scripts / com / google / analytics / debug / Warning.as < prev   
Encoding:
Text File  |  2011-10-17  |  1.1 KB  |  48 lines

  1. package com.google.analytics.debug
  2. {
  3.    import flash.events.TextEvent;
  4.    import flash.events.TimerEvent;
  5.    import flash.utils.Timer;
  6.    
  7.    public class Warning extends Label
  8.    {
  9.        
  10.       
  11.       private var _timer:Timer;
  12.       
  13.       public function Warning(text:String = "", timeout:uint = 3000)
  14.       {
  15.          super(text,"uiWarning",Style.warningColor,Align.top,false);
  16.          margin.top = 32;
  17.          if(timeout > 0)
  18.          {
  19.             _timer = new Timer(timeout,1);
  20.             _timer.start();
  21.             _timer.addEventListener(TimerEvent.TIMER_COMPLETE,onComplete,false,0,true);
  22.          }
  23.       }
  24.       
  25.       public function close() : void
  26.       {
  27.          if(parent != null)
  28.          {
  29.             parent.removeChild(this);
  30.          }
  31.       }
  32.       
  33.       override public function onLink(event:TextEvent) : void
  34.       {
  35.          switch(event.text)
  36.          {
  37.             case "hide":
  38.                close();
  39.          }
  40.       }
  41.       
  42.       public function onComplete(event:TimerEvent) : void
  43.       {
  44.          close();
  45.       }
  46.    }
  47. }
  48.